from GuoQing10_1.zy3.Base import Base
import openpyxl,pytest
from selenium import webdriver

@pytest.fixture(scope='function')
def driver():
    driver = webdriver.Edge()
    driver.maximize_window()
    yield driver
    driver.quit()

def test_sousuo(driver):
    word = openpyxl.load_workbook('jx.xlsx')
    excel = word['Sheet1']
    base = Base(driver)
    for row in excel.iter_rows(min_row=2,values_only=True):
        action = row[2]
        p = {}
        if action == 'goto':
            p['url']=row[4]
        elif action in ['send_keys','click','send_keys']:
            p['loc'] =[row[3],row[4]]

            if action == 'send_keys':
                p['info'] = row[5]
        elif action == 'sleep':
            p['timeout'] =row[5]
        method = getattr(base,str(action))
        method(**p)